/**
 * 
 */
package com.fox.webapp.domain;

import org.bson.types.ObjectId;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;

/**
 * @author yockii
 *
 */
@Document
public class Account {
	public static final short PAYWHERE_ACCOUNT	= 1;
	public static final short PAYWHERE_BANK 	= 2;
	
	@Id
	private ObjectId id;
	@Indexed
	private String accountNo;
	@DBRef
	private Broker broker;
	
	private String brokerName;
	
	private String selfDesc;
	
	private Double lastPay;
	
	private Double totalPayed;
	
	private Double minToPay;//最小返佣底线，即达到该值才会发放返佣
	
	/**
	 * @return the minToPay
	 */
	public Double getMinToPay() {
		return minToPay;
	}

	/**
	 * @param minToPay the minToPay to set
	 */
	public void setMinToPay(Double minToPay) {
		this.minToPay = minToPay;
	}

	@Transient
	private boolean isLookingForPay = false;
	
	/**
	 * @return the isLookingForPay
	 */
	public boolean isLookingForPay() {
		return isLookingForPay;
	}

	/**
	 * @param isLookingForPay the isLookingForPay to set
	 */
	public void setLookingForPay(boolean isLookingForPay) {
		this.isLookingForPay = isLookingForPay;
	}

	/**
	 * @return the totalPayed
	 */
	public Double getTotalPayed() {
		return totalPayed;
	}

	/**
	 * @param totalPayed the totalPayed to set
	 */
	public void setTotalPayed(Double totalPayed) {
		this.totalPayed = totalPayed;
	}

	private Double totalCommission;
	
	private Boolean active;
	
	private Short payWhere;
	@DBRef
	private Person person;
	

	/**
	 * @return the id
	 */
	public ObjectId getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(ObjectId id) {
		this.id = id;
	}

	public void setId(String id){
		this.id = new ObjectId(id);
	}
	/**
	 * @return the accountNo
	 */
	public String getAccountNo() {
		return accountNo;
	}

	/**
	 * @param accountNo the accountNo to set
	 */
	public void setAccountNo(String accountNo) {
		this.accountNo = accountNo;
	}

	/**
	 * @return the broker
	 */
	public Broker getBroker() {
		return broker;
	}

	/**
	 * @param broker the broker to set
	 */
	public void setBroker(Broker broker) {
		this.broker = broker;
		this.brokerName = broker.getName();
	}

	/**
	 * @return the selfDesc
	 */
	public String getSelfDesc() {
		return selfDesc;
	}

	/**
	 * @param selfDesc the selfDesc to set
	 */
	public void setSelfDesc(String selfDesc) {
		this.selfDesc = selfDesc;
	}

	/**
	 * @return the lastPay
	 */
	public Double getLastPay() {
		return lastPay;
	}

	/**
	 * @param lastPay the lastPay to set
	 */
	public void setLastPay(Double lastPay) {
		this.lastPay = lastPay;
	}

	/**
	 * @return the active
	 */
	public Boolean getActive() {
		return active;
	}

	/**
	 * @param active the active to set
	 */
	public void setActive(Boolean active) {
		this.active = active;
	}

	/**
	 * @return the totalCommission
	 */
	public Double getTotalCommission() {
		return totalCommission;
	}

	/**
	 * @param totalCommission the totalCommission to set
	 */
	public void setTotalCommission(Double totalCommission) {
		this.totalCommission = totalCommission;
	}

	/**
	 * @return the payWhere
	 */
	public Short getPayWhere() {
		return payWhere;
	}

	/**
	 * @param payWhere the payWhere to set
	 */
	public void setPayWhere(Short payWhere) {
		this.payWhere = payWhere;
	}

	/**
	 * @return the person
	 */
	public Person getPerson() {
		return person;
	}

	/**
	 * @param person the person to set
	 */
	public void setPerson(Person person) {
		this.person = person;
	}

	/**
	 * @return the brokerName
	 */
	public String getBrokerName() {
		return brokerName;
	}

	/**
	 * @param brokerName the brokerName to set
	 */
	public void setBrokerName(String brokerName) {
		this.brokerName = brokerName;
	}
	
}
